<?php
    class home_Ajax extends Ajax
    {
        public function loadMoreLastestProduct()
        {
            $oDatabase = new database();
            $sQuery = "
            PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
            PREFIX foaf: <http://xmlns.com/foaf/0.1/> 
            PREFIX bus: <".URL::getLink('id/bussiness#').">

            SELECT *  
            WHERE {
            ?uri rdf:type bus:product.
            ?uri bus:name ?name.
            ?uri bus:price ?price.
            ?uri bus:defaultImage ?image.
            OPTIONAL{?uri bus:isHightLight ?isHightLight.}
            OPTIONAL{?uri bus:hightLightImage ?hightLightImage.}
            ?uri bus:location ?location.
            ?uri bus:description ?description.
            ?uri bus:publishTime ?time.
            ?uri bus:hasManufacturer ?manufacturerUri.
            ?manufacturerUri bus:name ?manufacturerName.
            ?uri bus:ownUser ?userUri.
            ?userUri foaf:familyName ?ownUser.
            }
            ORDER BY DESC(?time)
            LIMIT 5 
            OFFSET ".$_POST['offset']."
            ";
            $aData = $oDatabase->loadQuery($sQuery);
            if(count($aData['result']['rows']) > 0)
            {
                $aParams = array(
                    'aProducts' => $aData['result']['rows'],
                    'isAjax' => true,
                );
                includeBlock('block/productBlock', $aParams);
            }
            else
            {
                echo 'COMPLETE';
            }
        }
    }
?>
